<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./WEB-INF/templates/turnitup_template.xhtml"
                xmlns:p="http://primefaces.org/ui"
                xmlns:h="http://xmlns.jcp.org/jsf/html"
                xmlns:f="http://xmlns.jcp.org/jsf/core">

    <ui:define name="top">
        <ui:include src="./WEB-INF/templates/logo_bar.xhtml"/>
        <ui:include src="./WEB-INF/templates/search_bar.xhtml"/>
        <p:breadCrumb>
            <p:menuitem outcome="index"/>
            <p:menuitem value="#{webtext.search_bar}" url="search" disabled="true"/>
            <p:menuitem value="#{productController.selected.name}" url="#"/>
        </p:breadCrumb>
    </ui:define>

    <ui:define name="menu_left">
        <ui:include src="./WEB-INF/templates/category_menu.xhtml"/>
    </ui:define>

    <ui:define name="basket">
        <ui:include src="./WEB-INF/templates/basket_widget.xhtml"/>
    </ui:define>

    <ui:define name="content">
        <h:panelGroup layout="block" id="content_panel">
            <p:messages id="messages_productinfo" showDetail="true" autoUpdate="true" closable="true" />
            <h:form>
                <p:graphicImage name="/images/#{productController.selected.image}" alt="#{productController.selected.image}"/>
                <h:panelGrid columns="2">                   
                    <h:outputText value="#{webtext.name}"/>
                    <h:outputText value="#{productController.selected.name}" title="#{webtext.name}"/>
                    <h:outputText value="#{webtext.description}"/>
                    <h:outputText value="#{productController.selected.description}" title="#{webtext.description}"/>
                    <h:outputText value="#{webtext.price}"/>
                    <h:outputText value="#{productController.selected.price}" title="#{webtext.price}"/>
                    <h:outputText value="#{webtext.stock}"/>
                    <h:outputText value="#{productController.selected.stock}" title="#{webtext.stock}"/>
                    <h:outputText value="#{webtext.category}"/>
                    <h:outputText value="#{productController.selected.categoryId.name}" title="#{webtext.category}"/>
                </h:panelGrid>
                <p:commandButton update=":basket_widget" title="#{webtext.add_to_basket}" value="#{webtext.add_to_basket}" action="#{basketController.addToBasket}" icon="ui-icon-cart">
                    <f:setPropertyActionListener target="#{basketController.orderedProduct.product}" value="#{productController.selected}"/>
                </p:commandButton>
            </h:form>
        </h:panelGroup>
    </ui:define>

    <ui:define name="footer">
        <ui:include src="./WEB-INF/templates/footer.xhtml"/>
    </ui:define>

</ui:composition>
